package com.example.tnot.Teacher.Homepart.InternalFragment.Frequent.NotManage;

import android.os.Bundle;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.tnot.R;
import com.example.tnot.Teacher.BaseFragment.BaseBackFragment;
import com.example.tnot.Teacher.Homepart.InternalFragment.Frequent.NotManage.Adapter.NotManageAdapter;
import com.example.tnot.Teacher.Homepart.InternalFragment.Frequent.NotManage.ItemBean.NotManage;

import java.util.ArrayList;
import java.util.List;

public class NotManageFragment extends BaseBackFragment {

    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_PARAM2 = "param2";
    View view;
    ImageView ib_back;
    RecyclerView rv_todo;
    TextView tv_empty;
    ImageView iv_add;
    private List<NotManage> notManageList;

    private String mParam1;
    private String mParam2;

    public NotManageFragment() {
        // Required empty public constructor
    }
    public static NotManageFragment newInstance(String param1, String param2) {
        NotManageFragment fragment = new NotManageFragment();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, param1);
        args.putString(ARG_PARAM2, param2);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mParam1 = getArguments().getString(ARG_PARAM1);
            mParam2 = getArguments().getString(ARG_PARAM2);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        view = inflater.inflate(R.layout.home_not_manage_fragment, container, false);
        InitViews();
        InitData();
        setListeners();

        rv_todo.setLayoutManager(new LinearLayoutManager(getActivity()));
        NotManageAdapter adapter = new NotManageAdapter(notManageList);
        rv_todo.setAdapter(adapter);

        return view;
    }

    private void InitData() {
        notManageList = new ArrayList<>();
        notManageList.add(new NotManage("上课"));
        notManageList.add(new NotManage("吃饭"));
        notManageList.add(new NotManage("睡觉"));
    }

    private void InitViews() {
        ib_back = view.findViewById(R.id.back);
        rv_todo = view.findViewById(R.id.rv_todo);
        tv_empty = view.findViewById(R.id.tv_empty);
        iv_add = view.findViewById(R.id.iv_add);
    }

    private void setListeners() {
        ib_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                handleBackPressed();
            }
        });
    }
}